#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
int main() {
    int t;
    cin >> t;
    while(t--) {
        int n;
        cin >> n;
        unordered_map<int, bool> h;
        vector<int> a;
        for(int i = 0; i < n; i++) {
            int temp;
            cin >> temp;
            if(!h[temp]) {
                a.push_back(temp);
                h[temp] = true;
            }
        }
        for(auto& s : a) {
            cout << s << " ";
        }
        cout << endl;
    }
    return 0;
}